package cn.wolfcode.p2p.controller;

import cn.wolfcode.p2p.base.util.Constants;
import cn.wolfcode.p2p.base.util.RequireLogin;
import cn.wolfcode.p2p.bussness.service.IBidRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;

@Controller
public class MainController {

    @Autowired
    private IBidRequestService bidRequestService;

    @RequestMapping("/main")
    public String mainPage(Model model){

        //publishPendngBidRequests
        model.addAttribute("publishPendngBidRequests",bidRequestService.queryPublishPendngBidRequests());
        //bidRequests
        model.addAttribute("bidRequests",bidRequestService.queryIndexData(Constants.BIDREQUEST_TYPE_NORMAL));
        model.addAttribute("expBidRequests",bidRequestService.queryIndexData(Constants.BIDREQUEST_TYPE_EXP));
        return "main";
    }
}
